<?php
//产品导航定义开始
$pro_nav  = '<div class="my_left_category"><div class="my_left_cat_list">';

//检索一级分类
$query = sprintf('SELECT ID, FAT_ID, CATENAME FROM %sproducts_cates WHERE FAT_ID = 0 ORDER BY ORDERID ASC', DB_TBL_PREFIX);

mysql_query("set names 'utf8'");
$first_result = mysql_query($query, $GLOBALS['DB']) or die(mysql_error($GLOBALS['DB']));

//如存在一级分类则定义产品导航
if (mysql_num_rows($first_result))
{
	$data_num = mysql_num_rows($first_result);
	$i = 0;
	
   while ($first_row = mysql_fetch_array($first_result))
   {		
		$pro_nav .= '<h2 ';
		
		//取消最后一个导航项的下边框虚线
		if ($i == $data_num -1)
		{
			$pro_nav .= 'class="last_item"'; 
		}
		
		//定义伪静态链接,包含该类别拼音形式目录名
		switch ($first_row['ID'])
		{
			case '1': 
			$dirname = 'fuhejinggai';
			break;
			
			case '2': 
			$dirname = 'shuzhijinggai';
			break;
			
			case '3': 
			$dirname = 'guisujinggai';
			break;
			
			case '4': 
			$dirname = 'fangdaojinggai';
			break;
			
			case '5': 
			$dirname = 'zhutiejinggai';
			break;
			
			case '6': 
			$dirname = 'shuinijinggai';
			break;
			
			case '7': 
			$dirname = 'xiaonongshuichushuikou';
			break;
			
			case '8': 
			$dirname = 'huafenchi';
			break;
			
			case '9': 
			$dirname = 'jianchajingpeijian';
			break;
			
			case '10': 
			$dirname = 'jianchajinggai';
			break;
			
			case '11': 
			$dirname = 'lingmeijinggai';
			break;
			
			case '12': 
			$dirname = 'boligangjinggai';
			break;
			
			case '13': 
			$dirname = 'xiaofangjinggai';
			break;
			
			case '14': 
			$dirname = 'tongxinjinggai';
			break;
			
			case '15': 
			$dirname = 'yushuibizi';
			break;
			
			case '16': 
			$dirname = 'digougaiban';
			break;
			
			case '17': 
			$dirname = 'digoubizi';
			break;
			
			case '45': 
			$dirname = 'zhengtishuibiaojing';
			break;
		}
		
		$pro_nav .= '><a href="../' . $dirname . '/chanpin-' . $first_row['ID'] . '-1.html">' . $first_row['CATENAME'] . '</a></h2>';
		
		$i = $i + 1;
   }
}

mysql_free_result($first_result);

//产品导航定义结束
$pro_nav .= '</div></div>';
?>